package com.wuxiaofan.exception;

import com.wuxiaofan.vo.ReturnResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author wuxiaofan
 */
@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(Exception.class)
    public ReturnResult customException(Exception e) {
        log.error("统一异常处理,异常信息:{}",e);
        return ReturnResult.failure(e.getMessage());
    }

}